﻿#pragma once
#include "../../LibDGGSBase/DGGSDefine.hpp"
_NNU_DGGS_BEGIN
using namespace Base;
namespace Kernel::ISEA4T
{
	class ISEA4TQuery
	{
	public:
		//初始化
		void init();

        ~ISEA4TQuery();
		//点找面
		void fromVertexSearchRelativeCells(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//点找边
		void fromVertexGetAssociationBoundary(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//边找点
		void fromEdgeGetBoundary(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//边找面
		void fromEdgeGetAssociationBoundary(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//面找边
		void fromCellGetBoundary(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
        //父格元
        void getVoxelParent(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getCellParent(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getEdgeParent(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getVertexParent(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //子格元
        void getVoxelChildren(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getCellChildren(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getEdgeChildren(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getVertexChildren(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
		//兄弟格元
        void getVoxelSiblings(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
		void getCellSiblings(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getEdgeSiblings(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        void getVertexSiblings(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
		//面找面
		void fromCellGetRelativeCells(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//面找点
		void fromCellGetRelativeVertexes(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//点找点
		void fromVertexGetRelativeVertexes(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
		//边找边
		void fromEdgeGetRelativeEdges(DGGSElementCode code, DGGSElementCode*& results,int& elementNum);
        //体找面
        void fromVoxelGetRelativeCells(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //体找边
        void fromVoxelGetRelativeEdges(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //体找点
        void fromVoxelGetRelativeVertexes(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //面找体
        void fromCellGetRelativeVoxels(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //边找体
        void fromEdgeGetRelativeVoxels(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //点找体
        void fromVertexGetRelativeVoxels(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
        //体找体
        void fromVoxelGetRelativeVoxels(DGGSElementCode code, DGGSElementCode*& results, int& elementNum);
	private:
		//格网类型
		DGGSGridType gridType = DGGSGridType::DGGS_ISEA4T;
        //点要素的各层级的最大行号
		long long int* maxRow = new long long int[MaxLevel];
		//点要素的各层级的最大列号
		long long int* vMaxCol = new long long int[MaxLevel];
		//线要素的各层级的最大列号
		long long int* eMaxCol = new long long int[MaxLevel];
		//面要素的各层级的最大列号
		long long int* fMaxCol = new long long int[MaxLevel];

		int level = 0;
	};

}
_NNU_DGGS_END